<?php /* Smarty version Smarty-3.0.8, created on 2011-11-12 23:48:00
         compiled from "D:/Inne/Dropbox/Projekty/NowyCMS/Szablon/Admin/Link/Lista.tpl" */ ?>
<?php /*%%SmartyHeaderCode:311814ebef7a03dea19-94249060%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '9110612a6a5ceb42b4a706fac6be4e3e600d3020' => 
    array (
      0 => 'D:/Inne/Dropbox/Projekty/NowyCMS/Szablon/Admin/Link/Lista.tpl',
      1 => 1321137953,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '311814ebef7a03dea19-94249060',
  'function' => 
  array (
  ),
  'has_nocache_code' => false,
)); /*/%%SmartyHeaderCode%%*/?>
<script type="text/javascript" src="http://<?php echo $_smarty_tpl->getVariable('domena')->value;?>
/P/js/flexigrid/flexigrid.pack.js"></script>
<link rel="stylesheet" type="text/css" href="http://<?php echo $_smarty_tpl->getVariable('domena')->value;?>
/P/style/flexigrid/flexigrid.pack.css" />

<div class="zawartosc">
    <table id="lista" cellspacing="0" style="display: none;"></table>
</div>


<script type="text/javascript">
    
    $(function() {
        $("#lista").flexigrid({
            url: '/cms/link/akcja,xml.html',
            colModel : [
                {display : 'ID', name : 'id', width : 40, sortable : true, align: 'right'},
                {display : 'Nazwa', name : 'nazwa', width : 250, sortable : true, align: 'center'},
                {display : 'Ilość wejść', name : 'licznik', width : 150, sortable : true, align: 'center'},
                {display : 'Data od', name : 'data_oo', width : 150, sortable : true, align: 'center'},
                {display : 'Data do', name : 'data_do', width : 100, sortable : true, align: 'center'},
                {display : 'Status', name : 'status', width : 100, sortable : true, align: 'center'}
            ],
            buttons : [
                {name : 'Dodaj', bclass: '', onpress : przyciski},
                {name : 'Edytuj', bclass: '', onpress : przyciski},
                {separator: true},
                {name : 'Usuń', bclass: '', onpress : przyciski}
            ],
            searchitems : [
                {display: 'Nazwa', name : 'nazwa', isdefault: true},
                {display: 'Data od', name : 'data_od'},
                {display: 'Data do', name : 'data_do'}
            ],
            sortname: "id",
            sortorder: "asc",
            showTableToggleBtn: false,
            singleSelect: true
        });
    });

    function przyciski(com, grid) {
        if (com == 'Dodaj') {
            window.location = '/cms/link/edycja/akcja,dodaj.html';
        }
        else if (com == 'Edytuj') {
            $('.trSelected', grid).each(function() {
                var id = $(this).attr('id');
                id = id.substring(id.lastIndexOf('row')+3);
                window.location = '/cms/link/edycja/akcja,edytuj,id,'+id+'.html';
            });
        } else if (com == 'Usuń') {
            $('.trSelected', grid).each(function() {
                var id = $(this).attr('id');
                id = id.substring(id.lastIndexOf('row')+3);
                if(confirm('Czy napewno usunąć rekord o id = '+id+'?')) {
                    var jqxhr = $.ajax({ 
                        url: '/cms/link/edycja/akcja,usun,id,'+id+'.html',
                        async: false
                    });
                }
            });
            $("#lista").flexReload();
        }
    }
    
</script>
